<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/activeqt/container/qaxwidget.cpp -->
<head>
  <title>Qt 4.3: QAxWidget Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QAxWidget Class Reference<br /><sup><sup>[<a href="qaxcontainer.html">QAxContainer</a> module]</sup></sup></h1>
<p>The QAxWidget class is a <a href="qwidget.html">QWidget</a> that wraps an ActiveX control. <a href="#details">More...</a></p>
<pre> #include &lt;QAxWidget&gt;</pre><p>Inherits <a href="qwidget.html">QWidget</a> and <a href="qaxbase.html">QAxBase</a>.</p>
<ul>
<li><a href="qaxwidget-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qaxwidget.html#QAxWidget">QAxWidget</a></b> ( QWidget * <i>parent</i> = 0, Qt::WindowFlags <i>f</i> = 0 )</li>
<li><div class="fn"/><b><a href="qaxwidget.html#QAxWidget-2">QAxWidget</a></b> ( const QString &amp; <i>c</i>, QWidget * <i>parent</i> = 0, Qt::WindowFlags <i>f</i> = 0 )</li>
<li><div class="fn"/><b><a href="qaxwidget.html#QAxWidget-3">QAxWidget</a></b> ( IUnknown * <i>iface</i>, QWidget * <i>parent</i> = 0, Qt::WindowFlags <i>f</i> = 0 )</li>
<li><div class="fn"/><b><a href="qaxwidget.html#dtor.QAxWidget">~QAxWidget</a></b> ()</li>
<li><div class="fn"/>virtual QAxAggregated * <b><a href="qaxwidget.html#createAggregate">createAggregate</a></b> ()</li>
<li><div class="fn"/>bool <b><a href="qaxwidget.html#doVerb">doVerb</a></b> ( const QString &amp; <i>verb</i> )</li>
</ul>
<ul>
<li><div class="fn"/>201 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li><div class="fn"/>19 public functions inherited from <a href="qaxbase.html#public-functions">QAxBase</a></li>
<li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li><div class="fn"/>12 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="protected-functions"></a>
<h3>Protected Functions</h3>
<ul>
<li><div class="fn"/>virtual bool <b><a href="qaxwidget.html#createHostWindow">createHostWindow</a></b> ( bool <i>initialized</i> )</li>
<li><div class="fn"/>virtual bool <b><a href="qaxwidget.html#initialize">initialize</a></b> ( IUnknown ** <i>ptr</i> )</li>
<li><div class="fn"/>virtual bool <b><a href="qaxwidget.html#translateKeyEvent">translateKeyEvent</a></b> ( int <i>message</i>, int <i>keycode</i> ) const</li>
</ul>
<ul>
<li><div class="fn"/>38 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li><div class="fn"/>5 protected functions inherited from <a href="qaxbase.html#protected-functions">QAxBase</a></li>
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
<li><div class="fn"/>1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"/>56 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li><div class="fn"/>1 property inherited from <a href="qaxbase.html#properties">QAxBase</a></li>
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li><div class="fn"/>19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li><div class="fn"/>3 signals inherited from <a href="qaxbase.html#signals">QAxBase</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li><div class="fn"/>4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"/>1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QAxWidget class is a <a href="qwidget.html">QWidget</a> that wraps an ActiveX control.</p>
<p>A QAxWidget can be instantiated as an empty object, with the name of the ActiveX control it should wrap, or with an existing interface pointer to the ActiveX control. The ActiveX control's properties, methods and events which only use <a href="qaxbase.html">QAxBase</a> supported data types, become available as Qt properties, slots and signals. The base class <a href="qaxbase.html">QAxBase</a> provides an API to access the ActiveX directly through the <tt>IUnknown</tt> pointer.</p>
<p>QAxWidget is a <a href="qwidget.html">QWidget</a> and can mostly be used as such, e.g&#x2e; it can be organized in a widget hierarchy and layouts or act as an event filter. Standard widget properties, e.g&#x2e; <a href="qwidget.html#enabled-prop">enabled</a> are supported, but it depends on the ActiveX control to implement support for ambient properties like e.g&#x2e; palette or font. QAxWidget tries to provide the necessary hints.</p>
<p>However, you cannot reimplement Qt-specific event handlers like mousePressEvent or keyPressEvent and expect them to be called reliably. The embedded control covers the QAxWidget completely, and usually handles the user interface itself. Use control-specific APIs (i.e&#x2e; listen to the signals of the control), or use standard COM techniques like window procedure subclassing.</p>
<p>QAxWidget also inherits most of its ActiveX-related functionality from <a href="qaxbase.html">QAxBase</a>, notably <a href="qaxbase.html#dynamicCall">dynamicCall</a>() and <a href="qaxbase.html#querySubObject">querySubObject</a>().</p>
<p><b>Warning:</b> You can subclass QAxWidget, but you cannot use the <tt>Q_OBJECT</tt> macro in the subclass (the generated moc-file will not compile), so you cannot add further signals, slots or properties. This limitation is due to the metaobject information generated in runtime. To work around this problem, aggregate the QAxWidget as a member of the <a href="qobject.html">QObject</a> subclass.</p>
<p>See also <a href="qaxbase.html">QAxBase</a>, <a href="qaxobject.html">QAxObject</a>, <a href="qaxscript.html">QAxScript</a>, and <a href="activeqt.html">ActiveQt Framework</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QAxWidget"></a>QAxWidget::QAxWidget ( <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0, <a href="qt.html#WindowType-enum">Qt::WindowFlags</a> <i>f</i> = 0 )</h3>
<p>Creates an empty <a href="qaxwidget.html">QAxWidget</a> widget and propagates <i>parent</i> and <i>f</i> to the <a href="qwidget.html">QWidget</a> constructor. To initialize a control, call <a href="qaxbase.html#control-prop">setControl</a>().</p>
<h3 class="fn"><a name="QAxWidget-2"></a>QAxWidget::QAxWidget ( const <a href="qstring.html">QString</a> &amp; <i>c</i>, <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0, <a href="qt.html#WindowType-enum">Qt::WindowFlags</a> <i>f</i> = 0 )</h3>
<p>Creates an <a href="qaxwidget.html">QAxWidget</a> widget and initializes the ActiveX control <i>c</i>. <i>parent</i> and <i>f</i> are propagated to the <a href="qwidget.html">QWidget</a> contructor.</p>
<p>See also <a href="qaxbase.html#control-prop">setControl</a>().</p>
<h3 class="fn"><a name="QAxWidget-3"></a>QAxWidget::QAxWidget ( IUnknown * <i>iface</i>, <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0, <a href="qt.html#WindowType-enum">Qt::WindowFlags</a> <i>f</i> = 0 )</h3>
<p>Creates a <a href="qaxwidget.html">QAxWidget</a> that wraps the COM object referenced by <i>iface</i>. <i>parent</i> and <i>f</i> are propagated to the <a href="qwidget.html">QWidget</a> contructor.</p>
<h3 class="fn"><a name="dtor.QAxWidget"></a>QAxWidget::~QAxWidget ()</h3>
<p>Shuts down the ActiveX control and destroys the <a href="qaxwidget.html">QAxWidget</a> widget, cleaning up all allocated resources.</p>
<p>See also <a href="qaxbase.html#clear">clear</a>().</p>
<h3 class="fn"><a name="createAggregate"></a><a href="qaxaggregated.html">QAxAggregated</a> * QAxWidget::createAggregate ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Reimplement this function when you want to implement additional COM interfaces for the client site of the ActiveX control, or when you want to provide alternative implementations of COM interfaces. Return a new object of a <a href="qaxaggregated.html">QAxAggregated</a> subclass.</p>
<p>The default implementation returns the null pointer.</p>
<h3 class="fn"><a name="createHostWindow"></a>bool QAxWidget::createHostWindow ( bool <i>initialized</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Creates the client site for the ActiveX control, and returns true if the control could be embedded successfully, otherwise returns false. If <i>initialized</i> is true the control has already been initialized.</p>
<p>This function is called by <a href="qaxwidget.html#initialize">initialize</a>(). If you reimplement initialize to customize the actual control instantiation, call this function in your reimplementation to have the control embedded by the default client side. Creates the client site for the ActiveX control, and returns true if the control could be embedded successfully, otherwise returns false.</p>
<h3 class="fn"><a name="doVerb"></a>bool QAxWidget::doVerb ( const <a href="qstring.html">QString</a> &amp; <i>verb</i> )</h3>
<p>Requests the ActiveX control to perform the action <i>verb</i>. The possible verbs are returned by <a href="qaxbase.html#verbs">verbs</a>().</p>
<p>The function returns true if the object could perform the action, otherwise returns false.</p>
<p>This function was introduced in Qt 4.1.</p>
<h3 class="fn"><a name="initialize"></a>bool QAxWidget::initialize ( IUnknown ** <i>ptr</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Calls QAxBase::initialize(<i>ptr</i>), and embeds the control in this widget by calling createHostWindow(false) if successful.</p>
<p>To initialize the control before it is activated, reimplement this function and add your initialization code before you call createHostWindow(true).</p>
<p>Reimplemented from <a href="qaxbase.html#initialize">QAxBase</a>.</p>
<p>This function was introduced in Qt 4.2.</p>
<h3 class="fn"><a name="translateKeyEvent"></a>bool QAxWidget::translateKeyEvent ( int <i>message</i>, int <i>keycode</i> ) const&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Reimplement this function to pass certain key events to the ActiveX control. <i>message</i> is the Window message identifier specifying the message type (ie. WM_KEYDOWN), and <i>keycode</i> is the virtual keycode (ie. VK_TAB).</p>
<p>If the function returns true the key event is passed on to the ActiveX control, which then either processes the event or passes the event on to Qt.</p>
<p>If the function returns false the processing of the key event is ignored by <a href="activeqt.html#activeqt">ActiveQt</a>, ie. the ActiveX control might handle it or not.</p>
<p>The default implementation returns true for the following cases:</p>
<p><table align="center" cellpadding="2" cellspacing="1" border="0">
<thead><tr valign="top" class="qt-style"><th>WM_SYSKEYDOWN</th><th>WM_SYSKEYUP</th><th>WM_KEYDOWN</th></tr></thead>
<tr valign="top" class="odd"><td>All keycodes</td><td>VK_MENU</td><td>VK_TAB, VK_DELETE and all non-arrow-keys in combination with VK_SHIFT, VK_CONTROL or VK_MENU</td></tr>
</table></p>
<p>This table is the result of experimenting with popular ActiveX controls, ie. Internet Explorer and Microsoft Office applications, but for some controls it might require modification.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
